Completed
Push — master ( 225284...365bc3 )
by Elbert
03:50 queued 03:19
created

index.js ➔ ???   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 1
rs 10
c 0
b 0
f 0
1
#!/usr/bin/env node
2
'use strict';
3
4
const Wappalyzer = require('./driver');
5
6
const args = process.argv.slice(2);
7
8
const url = args.shift() || '';
9
10
if ( !url ) {
11
  process.stderr.write('No URL specified\n');
12
13
  process.exit(1);
14
}
15
16
var options = {};
17
var arg;
18
19
while ( arg = args.shift() ) {
20
  var matches = /--([^=]+)=(.+)/.exec(arg);
21
22
  if ( matches ) {
23
    var key = matches[1].replace(/-\w/g, matches => matches[1].toUpperCase());
24
    var value = matches[2];
25
26
    options[key] = value;
27
  }
28
}
29
30
const wappalyzer = new Wappalyzer(url, options);
31
32
setTimeout(() => {
33
  console.log('force quit');
34
35
  process.exit(1);
36
}, 10000);
37
38
wappalyzer.analyze()
39
  .then(json => {
40
    process.stdout.write(JSON.stringify(json) + '\n')
41
42
    process.exit(0);
43
  })
44
  .catch(error => {
45
    process.stderr.write(error + '\n')
46
47
    process.exit(1);
48
  });
49